import { eidClass } from './libvbar-m-dxeid.so'
const eidObj = new eidClass();

const eid = {
    /**
     * @brief  Cloud Certificate Activation
     * @param {string} sn       device sn
     * @param {string} version  Custom version number for business
     * @param {string} mac      Device MAC address
     * @param {string} codeMsg  Cloud Certificate Activation Code Data
     * @returns 
     */
    active: function(sn, version, mac, codeMsg){
        
        if(!sn){
            throw("sn should not be null or empty")
        }
        if(!version){
            throw("version should not be null or empty")
        }
        if(!mac){
            throw("mac should not be null or empty")
        }
        if(!codeMsg){
            throw("codeMsg should not be null or empty")
        }
        return eidObj.active(sn, version, mac, codeMsg);
    },
    /**
     * @brief   Obtaining information
     */
    getInfo: function(){
        if(data == null || data.length < 1){
            throw("data should not be null or empty")
        }
        return eidObj.getInfo(data)
    },
    /**
     * @brief   Get version number
     */
    getVersion: function(){
        return eidObj.getVersion()
    },
}

export default eid;